<?php
/**
 * Created by PhpStorm.
 * User: 12133
 * Date: 2024/1/16
 * Time: 14:10
 */

namespace app\model\phone;


class Keyword extends Base
{
    public static function getfield(){
        return [
            'keyword', 'start_time', 'end_time', 'create_time', 'pc', 'phone', 'price', 'phone_price', 'pc_price','all'
        ];
    }

    public function getCreateTimeAttr($value){
        return date('Y-m-d',strtotime($value));
    }

    public function getBaiduyingxiaoAll($value){
        if(empty($value))return 0;
        return $value;
    }

    public function getKeywordsAttr($value){
        $temp = [];
        $array = explode(',',$value);
        if (count($array) > 10){
            for ($i = 0;$i<10;$i++)
                $temp[] = $array[$i];
        }else{
            $temp = $array;
        }
        return $temp;
    }
}